﻿<!--
    Copyright (c) 2013 Nokia Corporation.
-->
<phone:PhoneApplicationPage
    x:Class="HardwareInfo.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:src="clr-namespace:HardwareInfo"
    d:DataContext="{d:DesignData ViewModels/MainViewModelTestData.xaml}"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="True">
    
    <phone:PhoneApplicationPage.Resources>
        <Style x:Name="ListItemTextBlockStyleLarge" TargetType="TextBlock">
            <Setter Property="Margin" Value="10,0,0,10"/>
            <Setter Property="FontFamily" Value="Segoe WP Semilight"/>
            <Setter Property="FontSize" Value="42"/>
            <Setter Property="FontWeight" Value="Normal"/>
            <Setter Property="Foreground" Value="White"/>
        </Style>
        <Style x:Name="ListItemTextBlockStyleSmall" TargetType="TextBlock">
            <Setter Property="Margin" Value="10,0,0,0"/>
            <Setter Property="FontSize" Value="22"/>
            <Setter Property="FontWeight" Value="Normal"/>
            <Setter Property="Foreground" Value="White"/>
        </Style>        
        <src:BooleanToIconUriConverter x:Key="IconUriConverter" />
    </phone:PhoneApplicationPage.Resources>
    
    <!--LayoutRoot 是包含所有页面内容的根网格-->
    <Grid x:Name="LayoutRoot">
        <Grid.Background>
            <ImageBrush ImageSource="Assets/Images/Background.png"></ImageBrush>            
        </Grid.Background>

        <ProgressBar
            x:Name="MyProgressBar"
            Margin="0,-760,0,0"
            Height="10"
            Foreground="White"
            IsIndeterminate="True"
            />

        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel Grid.Row="0" Margin="12,17,0,28">
            <TextBlock FontWeight="Bold">
                <Run Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}" />
                <Run Text="{Binding Path=LocalizedResources.VersionNumberString, Source={StaticResource LocalizedStrings}}" />
            </TextBlock>
        </StackPanel>
        
        <!-- Pivot control -->
        <phone:Pivot Title=" ">
            <!-- Pivot item for hardware characteristics with simple boolean properties -->
            <phone:PivotItem Header="{Binding Path=LocalizedResources.AvailabilityTitle, Source={StaticResource LocalizedStrings}}">
                <phone:LongListSelector Margin="0,0,-12,0" ItemsSource="{Binding Items}">
                    <phone:LongListSelector.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="0,0,0,17" Background="Transparent">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                </Grid.RowDefinitions>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="60"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <Image
                                    Grid.Row="0"
                                    Grid.Column="0"
                                    Source="{Binding BooleanValue, Converter={StaticResource IconUriConverter}}"
                                />
                                <TextBlock
                                    Grid.Row="0"
                                    Grid.Column="1"
                                    Style="{StaticResource ListItemTextBlockStyleLarge}"
                                    Text="{Binding HardwareFeatureText}"
                                />
                            </Grid>
                        </DataTemplate>
                    </phone:LongListSelector.ItemTemplate>
                </phone:LongListSelector> 
            </phone:PivotItem>
            <phone:PivotItem Header="{Binding Path=LocalizedResources.CharacteristicsTitle, Source={StaticResource LocalizedStrings}}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <StackPanel Grid.Row="0" Margin="0,0,0,17">
                        <TextBlock
                            Text="{Binding Path=LocalizedResources.ScreenResolution, Source={StaticResource LocalizedStrings}}"
                            TextWrapping="Wrap"
                            Style="{StaticResource PhoneTextExtraLargeStyle}"
                            />
                        <TextBlock
                            Text="{Binding ScreenResolution}"
                            TextWrapping="Wrap"
                            Style="{StaticResource ListItemTextBlockStyleSmall}"
                            />
                    </StackPanel>
                    <StackPanel Grid.Row="1" Margin="0,10,0,17">
                        <TextBlock
                            Text="{Binding Path=LocalizedResources.Memory, Source={StaticResource LocalizedStrings}}"
                            TextWrapping="Wrap"
                            Style="{StaticResource PhoneTextExtraLargeStyle}"
                            />
                        <TextBlock
                            Text="{Binding MemoryStatus}"
                            TextWrapping="Wrap"
                            Style="{StaticResource ListItemTextBlockStyleSmall}"
                            />
                        <ProgressBar
                            Margin="0,5,0,0"
                            Value="{Binding MemoryUsedInPercentages}"
                            />
                    </StackPanel>
                </Grid>
            </phone:PivotItem>
        </phone:Pivot>
    </Grid>

</phone:PhoneApplicationPage>